import http from '../utils/request.js'
/**
 * 微信登录获取code
 */
export function wxLogin() {
    return new Promise((resolve, reject) => {
        wx.login({
            timeout: 10000,
            success: (result) => {
                resolve(result);
            },
            fail: () => {
                reject(1);
            }
        });
    });
}

/**
 * 用户授权
 */
export function authUser({ code }) {
    let params = {
        code
    }
    // if(userInfo){
    //     params.userInfo = userInfo
    // }
    
    return http.post('wx_login/oauth_user', {
        ...params
    }, null);
}